#ifndef _MYCOMPUTER_HXX_
#define _MYCOMPUTER_HXX_

#include "mytypes.h"

#include <vector>
#include <iostream>

#include "buffer.hxx"

using namespace std;

namespace MyComputer
{
  class MACAddress
  {
  public:
    MACAddress();
    MACAddress(const tByte mac[6]);
    MACAddress(const MACAddress &model);
    ~MACAddress();
    void Set(const tByte mac[6]);
    tByte &operator [] (tUInt32 index);
    const tByte &operator [] (tUInt32 index) const;
    
  private:
    tByte _mac[6];
  };
  
  class HardDisk
  {
  public:
    HardDisk();
    HardDisk(const HardDisk &original);
    ~HardDisk();

    void Clear();
    void SetId(tUInt32 id);
    inline tUInt32 GetId() const;
    bool IsIdAvailable() const;

    void SetModel(const string &model);
    inline const string &GetModel() const;
    bool IsModelAvailable() const;

    void SetSerial(const string &serial);
    inline const string &GetSerial() const;
    inline bool IsSerialAvailable() const;
 
    void SetCacheSize(tUInt32 cachesize);
    inline tUInt32 GetCacheSize() const;
    inline bool IsCacheSizeAvailable() const;
   
    void SetDiskSize(tUInt64 disksize);
    inline tUInt64 GetDiskSize() const;
    inline bool IsDiskSizeAvailable() const;

    void SetControllerIndex(tUInt32 controller_index);
    tUInt32 GetControllerIndex() const;
    bool IsControllerIndexAvailable() const;
    
    void SetControllerRevisionNumber(const string &controller_revision_number);
    inline const string &GetControllerRevisionNumber() const;
    inline bool IsControllerRevisionNumberAvailable() const;

    void SetType(const string &type);
    const string &GetType() const;
    bool IsTypeAvailable() const;

  private:
    tUInt32 _id;
    bool _id_available;

    string _model;
    bool _model_available;

    string _serial;
    bool _serial_available;

    tUInt32 _cachesize;
    bool _cachesize_available;

    tUInt64 _disksize;
    bool _disksize_available;

    tUInt32 _controllerindex;
    bool _controllerindex_available;

    string _controller_revision_number;
    bool _controller_revision_number_available;

    string _type;
    bool _type_available;
  };

  typedef vector<MACAddress> tMACAddressList;
  typedef vector<HardDisk> tHardDiskList;
  
  /// \brief Returns the list of MAC Addresses found on current computer.
  ///
  /// If successfull, this function returns the number of MAC Addresses found (>=0).
  /// If failed, -1 is returned.
  tUInt32 GetMACAddresses(tMACAddressList &maclist);

  /// \brief Returns the list of Hard Disks found on current computer.
  ///
  /// If successfull, this function returns the number of HardDisks found (>=0).
  /// If failed, -1 is returned.
  tUInt32 GetHardDisks(tHardDiskList &hdlist);

  /// \brief Returns the Computer ID (obtained from hard disk id).
  tUInt32 GetComputerId();

  ostream &operator<<(ostream &s, const MyComputer::MACAddress &mac); 
  
  ostream &operator<<(ostream &s, const MyComputer::HardDisk &hd); 

  Buffer &operator<<(Buffer &s, const MyComputer::MACAddress &mac); 
  
  Buffer &operator<<(Buffer &s, const MyComputer::HardDisk &hd); 
}


#endif // _MYCOMPUTER_HXX_
